package com.darren.euc.job;

import java.sql.SQLException;
import java.util.List;

import javax.naming.NamingException;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

import com.darren.euc.entity.SystemParameter;
import com.darren.euc.service.MeetingroomService;
import com.darren.euc.service.SystemService;

/**
 * 我的会议 -1 全部 0 已取消 1 未开始 2 已结束
 */

@Component
public class MeetingRoomTask {	

	private static final Logger log = Logger.getLogger(MeetingRoomTask.class);
	
	@Autowired
    private MeetingroomService meetingroomService;

	
	/**
	 * 定时刷新系统参数缓存
	 * @throws SQLException
	 * @throws NamingException
	 */
	@Scheduled(cron = "0 0/50 * * * ?")
	public void refreshSystemParameter() throws SQLException, NamingException {
		StopWatch stopWatch = new StopWatch();
		stopWatch.start();
		log.info("generate meetingroom books data job launch start ..." + System.currentTimeMillis());		
		try {

			//meetingroomService.generateMeetingroomData(15);
			
		} catch (Exception e) {
		    log.error(e.getMessage(),e);
		}	
		log.info("generate meetingroom books data job launch end   ..." + System.currentTimeMillis());
		stopWatch.stop();
		log.info("generate meetingroom books data job launch total time ..."+ stopWatch.getTotalTimeMillis());
	}
	
}
